<?php
/**
 * Created by PhpStorm.
 * User: lenovo
 * Date: 2017/4/17
 * Time: 18:06
 */
$dsn="mysql:dbname=baoan-survey;host=localhost";
$db_user='root';
$db_pass='root';
try{
    $pdo=new PDO($dsn,$db_user,$db_pass);
    if($pdo){
        //查询
        $sql="select * from feiqiye";
        $pro=$pdo->query($sql);
        foreach($pro as $row){
            echo $row['xxmc'].'<br/>';
        }
    }
}catch(PDOException $e){
    echo '数据库连接失败'.$e->getMessage();
}
?>